﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;

namespace FlatOut.Dal.Domain
{
    public enum TypeScore {
        Lap,
        Circuit 
    }

    [Table("Score", Schema = "dbo")]
    public class Score
    {
        [Key]
        public int Id { get; set; }

        public int CircuitId { get; set; }
        public virtual Circuit Circuit { get; set; }

        public int CarId { get; set; }
        public virtual Car Car { get; set; }

        public int UserId { get; set; }
        public virtual User User { get; set; }

        public DateTime Date { get; set; }

        public TimeSpan Time { get; set; }
        
        [Column("TypeScore")]
        public int TypeScoreInt { get; set; }

        [NotMapped]
        public TypeScore TypeScore 
        {
            get { return (TypeScore)TypeScoreInt; }
            set { TypeScoreInt = value.GetHashCode(); }
        }
    }
}